#!/bin/bash

#1.进入TSNLight目录进行编译
cd ./TSNLight

#(1)编译libsim库 
cd ./complib/libsim
make clean
make
cd -

#(2)编译libtsmp库，$1为TSN_FPGA或TSN_SIM
cd ./complib/libtsmp
make clean
make TYPE=$1
cd -

#(3)编译libtsninsight库
cd ./complib/libtsninsight
make clean
make
cd -

#(4)进入cjson目录进行编译
cd ./complib/cjson
make clean
make
cd -

#(5)编译tsnlight，$1为TSN_FPGA或TSN_SIM
make clean
make TYPE=$1


#2.进入opensync目录进行编译
cd ../opensync/

#(1)编译libsim库 
cd ./complib/libsim
make clean
make
cd -

#(2)编译libtsmp库，$1为TSN_FPGA或TSN_SIM
cd ./complib/libtsmp
make clean
make TYPE=$1
cd -

#(3)编译libtsninsight库
cd ./complib/libtsninsight
make clean
make
cd -

#(4)进入cjson目录进行编译
cd ./complib/cjson
make clean
make
cd -

#(5)编译802.1as，$2为READ或REPORT
cd ./802.1as
make clean
make OSS_TYPE=$2

#3.进入l2switch目录进行编译
cd ../../l2switch

#(1)编译libsim库 
cd ./complib/libsim
make clean
make
cd -

#(2)编译libtsmp库，$1为TSN_FPGA或TSN_SIM
cd ./complib/libtsmp
make clean
make TYPE=$1
cd -


#(3)编译libtsninsight库
cd ./complib/libtsninsight
make clean
make
cd -

#(4)进入cjson目录进行编译
cd ./complib/cjson
make clean
make
cd -


#(4)编译l2switch
make clean
make

